<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<div class="span12 box-content">
	<form class="form-inline well" id="studentFilter_form">
		<div class="controls controls-row">
			<label>学院:</label>
			<select class="span2" style="display:inline;" name="college">
			  <c:forEach items="${colleges }" var="c">
			 	 <option value="${c.id }" ${c.id==clgId?"selected='selected'":""}>${c.name }</option>
			  </c:forEach>
			</select>
			<label>系:</label>
			<select class="span2" style="display:inline;" name="department">
			  <c:forEach items="${departments }" var="d">
			 	 <option value="${d.id }" ${d.id==depId?"selected='selected'":""}>${d.name }</option>
			  </c:forEach>
			</select>
			<label>班级:</label>
			<select class="span2" style="display:inline;" name="classInfo">
			  <c:forEach items="${classList }" var="c">
			 	 <option value="${c.id }" ${c.id==classId?"selected='selected'":""}>${c.name }</option>
			  </c:forEach>
			</select>
			<button type="button" id="studentFilter_go">筛选</button>
		</div>
	</form>
	<div class="span12">共有${studentCount}条数据,${totalPage }页</div>
	<table class="table table-striped table-bordered" id="student_list_table">
		<thead>
		 <tr role="row">
		 	<th >学号</th>
		 	<th>姓名</th>
		 	<th>性别</th>
		 	<th>年级</th>
		 	<th>班级</th>
		 	<th>QQ</th>
		 	<th>电话</th>
		 	<th>更多</th>
		 </tr>
		</thead>   
		<tbody>
		<c:forEach items="${student }" var="s">
			<tr>
				<td>${s.no }</td>
				<td>${s.name }</td>
				<td>${s.gender }</td>
				<td>${s.grade }</td>
				<td>${s.classInfo.name }</td>
				<td>${s.qq }</td>
				<td>${s.telephone }</td>
				<td class="center">
				<c:if test="${!user.superAdmin &&user.collegeId!=s.classInfo.branch.prof.department.college.id}">
					<c:set var="editDisabled" value="disabled"/>
				</c:if>
					<button type="button" class="btn btn-info student_edit" data-studentId="${s.id }"  ${editDisabled }>
						<i class="icon-edit icon-white"></i>  
						编辑
					</button>
					<button type="button" class="btn btn-danger student_delete"  data-target="#student_delete_box" data-toggle="modal" data-studentId="${s.id }" ${editDisabled }>
						<i class="icon-trash icon-white"></i>  
						删除
					</button>
					<c:if test="${editDisabled!=null }">
						无权操作
					</c:if>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination  pagination-centered"
			data-totalPage="${totalPage }" 
			data-currentPage="${page }" 
			data-url="<%=basePath%>admin/student/showStudentList/${clgId }/${depId }/${classId}/{page}"
			style="display:none">
	</div>
	<div class="well">
		<button type="button" class="btn btn-primary" id="student_add"  >
			<i class=" icon-plus icon-white"></i>
			新建一个学生
		</button>
		<button type="button" class="btn btn-primary" id="student_add_excel" data-target="#student_add_excel_box" data-toggle="modal" >
			<i class=" icon-plus icon-white"></i>  
			从excel导入学生列表
		</button>
		<br/>
		<br/>
		<p>导入说明:支持xls(Excel 2003默认格式)和xlsx(Excel 2007之后)格式的文件.<a href="<%=basePath %>resource/studentImportSample.zip">点击这里下载示例文件</a></p>
	</div>
</div>

<!-- 批量导入 开始-->
<div class="modal hide fade" id="student_add_excel_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>批量导入学生</h3>
	</div>
	<div class="modal-body">
		<div id="student_add_excel_box_alert_container" ></div><br/>
		<span class="btn btn-success fileinput-button" id="student_add_excel_box_file">
			<span>选择文件</span>
			<input type="file" name="excel"  >
		</span>
		<span id="student_add_excel_box_file_name">未选择</span>
		<div class="progress progress-info progress-striped" style="margin-top: 3%;display:none" id="student_add_excel_box_progress">
				<div class="bar" style="width: 0%" ></div>
		</div>
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-primary" id="student_add_excel_box_confirm">确定</a>
	</div>
</div>
<!-- 批量导入 结束 -->
<!-- 删除确认 开始-->
<div class="modal hide fade" id="student_delete_box">
	<div class="modal-header">
		<button type="button" class="close" data-dismiss="modal">×</button>
		<h3>删除学生</h3>
	</div>
	<div class="modal-body">
		<input type="hidden" name="stuId"/>
            确认删除?删除动作不可撤销!
	</div>
	<div class="modal-footer">
		<a href="#" class="btn" data-dismiss="modal">取消</a>
		<a href="#" class="btn btn-danger" id="student_delete_box_delete">删除</a>
	</div>
</div>
<!-- 删除确认 结束 -->